using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace TVSGPP.tools
{
	public class frmAppPrescription : Form
	{
		private IContainer components = null;
		private CheckBox ckbPrescription;
		private Button btnSave;
		public GroupBox grB1;
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.ckbPrescription = new CheckBox();
			this.grB1 = new GroupBox();
			this.btnSave = new Button();
			this.grB1.SuspendLayout();
			base.SuspendLayout();
			this.ckbPrescription.AutoSize = true;
			this.ckbPrescription.Font = new Font("Arial", 9f);
			this.ckbPrescription.Location = new Point(18, 23);
			this.ckbPrescription.Name = "ckbPrescription";
			this.ckbPrescription.Size = new Size(222, 19);
			this.ckbPrescription.TabIndex = 1;
			this.ckbPrescription.Text = "Kê đơn theo số lượng thuốc tồn kho";
			this.ckbPrescription.UseVisualStyleBackColor = true;
			this.grB1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.grB1.Controls.Add(this.ckbPrescription);
			this.grB1.Enabled = false;
			this.grB1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.grB1.Location = new Point(12, 7);
			this.grB1.Name = "grB1";
			this.grB1.Size = new Size(375, 374);
			this.grB1.TabIndex = 0;
			this.grB1.TabStop = false;
			this.grB1.Text = "Tuỳ chọn khi kê đơn";
			this.btnSave.Cursor = Cursors.Hand;
			this.btnSave.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnSave.Location = new Point(12, 387);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new Size(90, 30);
			this.btnSave.TabIndex = 11;
			this.btnSave.Text = "Ghi nhận";
			this.btnSave.UseVisualStyleBackColor = true;
			this.btnSave.Click += new EventHandler(this.btnSave_Click);
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.White;
			base.ClientSize = new Size(399, 427);
			base.Controls.Add(this.btnSave);
			base.Controls.Add(this.grB1);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			base.Name = "frmAppPrescription";
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "Tuỳ biến giao diện";
			base.Load += new EventHandler(this.frmAppOptionMain_Load);
			this.grB1.ResumeLayout(false);
			this.grB1.PerformLayout();
			base.ResumeLayout(false);
		}
		public frmAppPrescription()
		{
			this.InitializeComponent();
		}
		private void btnSave_Click(object sender, EventArgs e)
		{
			try
			{
				RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\TVSGPP", true);
				if (this.grB1.Enabled)
				{
					registryKey.SetValue("Prescription", this.ckbPrescription.Checked.ToString());
				}
				registryKey.Close();
				MessageBox.Show("Dữ liệu đã được cập nhật vào hệ thống!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
		private void frmAppOptionMain_Load(object sender, EventArgs e)
		{
			try
			{
				RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\TVSGPP", true);
				if (this.grB1.Enabled)
				{
					this.ckbPrescription.Checked = bool.Parse(registryKey.GetValue("Prescription").ToString());
				}
				registryKey.Close();
			}
			catch
			{
			}
		}
	}
}
